#include<iostream>
#include<unordered_map>
using namespace std;
class Solution
{
public:
    vector<int> twoSum(vector<int>& nums, int target)
    {
        unordered_map<int, int>hash;
        hash[nums[0]]=0;
        for (int i = 1; i < nums.size(); i++)
        {
            if (hash.count(target - nums[i]))
            {
                return{ i,hash[target - nums[i]] };
            }
            hash[nums[i]] = i;
        }
        return { -1,-1 };
    }
};
